package com.example.pingxue.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.Set;

@Entity
@Getter
@Setter
public class TClass extends LogicEntity {
    @Column
    private String TTime;
    @Column
    private String TWeek;
    @Column
    private String room;
    @Column
    private Integer capacity;

    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnoreProperties(value = {"clses", "handler", "hibernateLazyInitializer"})
    private Course course;

    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnoreProperties(value = {"clses", "handler", "hibernateLazyInitializer"})
    private Teacher teacher;

    @OneToMany(mappedBy = "clazz",
            cascade = CascadeType.ALL,
            orphanRemoval = true,
            fetch = FetchType.LAZY)
    @JsonIgnoreProperties(value = {"clses", "handler", "hibernateLazyInitializer"})
    private Set<Selection> selections = new HashSet<>();


}
